﻿using System;
using System.Linq;
using System.Text;
using DevExpress.Xpo;
using DevExpress.ExpressApp;
using System.ComponentModel;
using DevExpress.ExpressApp.DC;
using DevExpress.Data.Filtering;
using DevExpress.Persistent.Base;
using System.Collections.Generic;
using DevExpress.ExpressApp.Model;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;

namespace aztall.Module.BusinessObjects
{
	[NonPersistent]
	public abstract class DomainObject : RootObject
	{
		protected Domain _Domain;
		public DomainObject(Session session)
				: base(session)
		{
		}
		public override void AfterConstruction()
		{
			base.AfterConstruction();
			if (Session.IsNewObject(this))
				_Domain = base.Session.GetObjectByKey<Domain>(Env.CurrentDomainOid);
		}
		[Browsable(false)]
		[RuleRequiredField(DefaultContexts.Save, SkipNullOrEmptyValues = false)]
		public virtual Domain Domain
		{
			get { return _Domain; }
			set { SetPropertyValue<Domain>(nameof(Domain), ref _Domain, value); }
		}
	}
}
